<?php
namespace Controller\Admin\Setting;
class Edit extends \Controller\Admin\Setting
{
    public $data;
    public $path = array('setting', 'setting.edit');
    protected $_tpl = 'admin/setting/edit';

    public function get($id)
    {
        if ($id) {
            $this->result = \Model\Setting::find($id);
        } else {
            $this->result = array();
        }
    }

    public function post($id)
    {
        $data = $_POST;
        if ($id) {
            $settingModel = \Model\Setting::find($id);
        } else {
            $settingModel = new \Model\Setting();
        }
        $settingModel->set($data);
        $settingModel->save();
        redirect('/admin/setting');
    }
}